package lib.quasar.base.http;

import android.text.TextUtils;

import lib.quasar.context.BaseConstant;

/**
 * description: 服务器返回数据类型
 * created by kalu on 2018/3/23 8:52
 */
public class HttpResult<T> {

    private String msgCode = "";
    private String checkCode = "";
    private String status = "";
    private String msg = "";
    private T msgDatas;

    public String getMsgCode() {
        return msgCode;
    }

    public void setMsgCode(String msgCode) {
        this.msgCode = msgCode;
    }

    public String getCheckCode() {
        return checkCode;
    }

    public void setCheckCode(String checkCode) {
        this.checkCode = checkCode;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getMsgDatas() {
        return msgDatas;
    }

    public void setMsgDatas(T msgDatas) {
        this.msgDatas = msgDatas;
    }

    public boolean isSucc() {

        final boolean ok1 = !TextUtils.isEmpty(status) && BaseConstant.ONE.equals(status);
        final boolean ok2 = !TextUtils.isEmpty(msgCode) && msgCode.endsWith("0000");
        return ok1 || ok2;

//        final boolean ok1 = !TextUtils.isEmpty(status) && BaseConstant.ONE.equals(status);
//        return ok1;
    }
}